package com.threemeals.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * 
* <p>版权所有:(C)2016-2018 Three-Meals</p>
* @作者: 陈荣安
* @日期: 2017年4月25日 下午2:02:27
* @描述: [ManagePageController]页面访问WEB控制器
 */
@Controller
@RequestMapping("/mobile")
public class MobilePageController {
	static Logger logger = LogManager.getLogger(LogManager.ROOT_LOGGER_NAME);
	

	/**
	 * 主页
	 */
	@RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView indexPage() {
		logger.info("用户进入手机主页");
		return new ModelAndView("/mobile/index");
    }
	/**
	 * 主页
	 */
	@RequestMapping(value = "{pageName}", method = RequestMethod.GET)
    public ModelAndView page(@PathVariable("pageName") String pageName) {
		logger.info("用户进入手机页面"+pageName);
		return new ModelAndView("/mobile/"+pageName);
    }
	/**
	 * 页面转换
	 * @param fileName 路径名
	 * @param pageName  页面名
	 * @return
	 */
	@RequestMapping(value = "{fileName}/{pageName}", method = RequestMethod.GET)
    public ModelAndView commonPage(@PathVariable("fileName") String fileName,@PathVariable("pageName") String pageName) {
		logger.info("用户进入手机" + fileName + "/" + pageName + "页面");
		return new ModelAndView("/mobile/"+fileName + "/" + pageName);
    }
}
